using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;

namespace LFromeWork
{
    public class HttpManager
    {
        /// <summary>
        /// 正式账号服务器Url
        /// </summary>
        private string m_WebAccountUrl;
        /// <summary>
        /// 测试账号服务器Url
        /// </summary>
        private string m_TestWebAccountUrl;
        /// <summary>
        /// 是否测试环境
        /// </summary>
        private bool m_IsTest;
        /// <summary>
        /// 真实账号服务器Url
        /// </summary>
        public string RealWebAccountUrl { get { return "http://" + RealIpAndPort + "/"; } }
        public string RealIpAndPort { get { return m_IsTest ? m_TestWebAccountUrl : m_WebAccountUrl; } }

        public HttpManager()
        {
            m_WebAccountUrl = GameLaunch.ParamsSettings.WebAccountUrl;
            m_TestWebAccountUrl = GameLaunch.ParamsSettings.TestWebAccountUrl;
            m_IsTest = GameLaunch.ParamsSettings.IsTest;
        }

        #region Get
        public void Get(string url, Action<HttpCallBackArgs> callBack = null)
        {
            HttpRoutine.Create().Get(url, callBack);
        }
        #endregion

        #region Post
        public void Post(string url, string json = null, Action<HttpCallBackArgs> callBack = null)
        {
            HttpRoutine.Create().Post(url, json, callBack);
        }
        #endregion

        public void Dispose()
        {
            
        }
    }
}